<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$this->model('nfee')->up_sifang();
$tabs=array(
	array('op'=>'list','title'=>'能量池释放期号'),
);
set_html('tabs',$tabs);
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['timeno']){
		$params['end_time']=strtotime($_RQ['timeno']);
		$return['params']['timeno']=$_RQ['timeno'];
	}
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'orderby'=>'id desc',
	);
	$list=$this->get_list('nfee',$parameter,$total);
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['timeno']=date('Ymd',$item['end_time']);
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'list'=>array(
			'tip'=>'按周期，自动结算活动营业额。',
			'data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'timeno','title'=>'周期号','type'=>'string'),
			array('name'=>'orderfee','title'=>'营业额','type'=>'string'),
			array('name'=>'fee','title'=>'量值池释放额','type'=>'string'),
			array('name'=>'user_num','title'=>'参与释放增值人数','type'=>'string'),
			array('name'=>'start_time','title'=>'开始时间','type'=>'time'),
			array('name'=>'end_time','title'=>'结束时间','type'=>'time'),			
		)),
		'search'=>array(
			array('type'=>'string','width'=>15,'name'=>'timeno','title'=>'周期号'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}